/*
package app.contoller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import pojo.User;
@RestController
public class ConsumerController {

    @Autowired
    private LoadBalancerClient loadBalancerClient;
    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("user/{id}")
    public User getUserBy(@PathVariable Integer id){
        ServiceInstance si = loadBalancerClient.choose("nacos-provider");
        //指定要调用的服务
        String url = "http://"+si.getHost()+":"+si.getPort()+"/findId/"+id;
        return restTemplate.getForObject(url, User.class);
    }
}
*/
